package com.ktjy.controller;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * @author lqm
 * @ClassName IndexController
 * @description: TODO
 */
@Controller
public class IndexController {
    @Resource
    RedisTemplate redisTemplate;


    @RequestMapping("/")
    public String hello( Model model){
//        System.out.println(request.getURI());

        redisTemplate.opsForZSet().add("perSet","127.0.0.1",System.currentTimeMillis());
//        long perCount=  redisTemplate.opsForValue().increment("perCount");
        model.addAttribute("perCount",redisTemplate.opsForZSet().zCard("perSet"));




        return "index";
    }
}
